﻿using SharePointUtilitiesForDevelopers.Action;
using System.Windows.Forms;

namespace SharePointUtilitiesForDevelopers.Actions
{
    /// <summary>
    /// A custom action to delete list items.
    /// </summary>
    public class DeleteListItemsAction: IAction
    {
        /// <summary>
        /// Gets the title.
        /// </summary>
        /// <value>The title.</value>
        public string Title
        {
            get { return Properties.Resources.DeleteListItemsActionTitle; }
        }

        /// <summary>
        /// Gets the description.
        /// </summary>
        /// <value>The description.</value>
        public string Description
        {
            get { return Properties.Resources.DeleteListItemsActionDescription; }
        }

        /// <summary>
        /// Gets the target.
        /// </summary>
        /// <value>The target.</value>
        public ActionTarget Target
        {
            get { return ActionTarget.List | ActionTarget.ListView; }
        }
        
        /// <summary>
        /// Executes the action.
        /// </summary>
        /// <param name="actionContext">The context.</param>
        public void Execute(ActionContext actionContext)
        {
            if(actionContext.Entity is SharePointList)
            {
                //var list = (SharePointList) entity;
                MessageBox.Show(actionContext.Owner as IWin32Window, "Implement delete items for list!");
            }

            if(actionContext.Entity is SharePointListView)
            {
                //var view = (SharePointListView)entity;
                MessageBox.Show(actionContext.Owner as IWin32Window, "Implement delete items for list view!");
            }
        }

    }
}